package com.nzy.service.impl;

import com.nzy.dao.mapper.StockMqMapper;
import com.nzy.dao.mapper.StockRecordMapper;
import com.nzy.entity.StockMq;
import com.nzy.entity.StockRecord;
import com.nzy.service.StockRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class StockRecordServiceImpl implements StockRecordService {

    @Autowired
    private StockRecordMapper stockRecordMapper;

    @Autowired
    private StockMqMapper stockMqMapper;

    @Override
    public void insert(StockRecord stockRecord) {
        stockRecord.setCreateTime(new Date());
        stockRecord.setOperateType(0);
        stockRecordMapper.insert(stockRecord);
    }

    @Override
    public void insertStockMq(StockMq stockMq) {
        stockMqMapper.insert(stockMq);
    }

    @Override
    public Integer getStockMq(Integer id) {
        return stockMqMapper.selectByOrderId(id);
    }
}
